//
// RS Game Framework
// Copyright © 2009 Jedd Haberstro
// jhaberstro@gmail.com
// 
// $Id:
//

#ifndef RS_UNITTEST_TESTSUITE_HPP
#define RS_UNITTEST_TESTSUITE_HPP

#include "rs/unittest/TestCase.hpp"
#include "rs/Assert.hpp"
#include <vector>
#include <cstring>

namespace rs
{
    namespace unittest
    {
        class TestSuite
        {
        public:

            typedef std::vector< TestCase* > TestCaseContainer;

        public:
            
            TestSuite(Char const* suiteName);
            
            void AddTestCase(TestCase* test);
            
            Char const* GetName() const;
            
            RsSize GetTestCount() const;
            
            TestCaseContainer const& GetTests() const;
            
        private:
            
            TestCaseContainer tests_;
            Char const* suiteName_;
        };
        
                
        inline TestSuite::TestSuite(Char const* suiteName)
        : suiteName_(suiteName) {
        }
        
        inline void TestSuite::AddTestCase(TestCase* test) {
            RS_ASSERT(test != 0, "test must be not null");
            RS_ASSERT(std::strcmp(test->GetSuiteName(), suiteName_) == 0, "test belongs to a different suite");
            tests_.push_back(test);
        }
        
        inline Char const* TestSuite::GetName() const {
            RS_ASSERT(suiteName_ != 0, "suiteName_ is null");
            return suiteName_;
        }
        
        inline RsSize TestSuite::GetTestCount() const {
            return tests_.size();
        }
        
        inline TestSuite::TestCaseContainer const& TestSuite::GetTests() const {
            return tests_;
        }
    }
}


#endif // RS_UNITTEST_TESTSUITE_HPP